package com.ticket.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Author: lihua
 * @Date: 2024/1/13 23:31
 * @Version: v1.0.0
 * @Description:
 **/
public class TicketServer {
    public static void main(String[] args){
        try {
            //开启服务端并绑定端口
            ServerSocket serverSocket = new ServerSocket(8888);
            while (true) {
                // 等待客户端的连接
                Socket socket = serverSocket.accept();
                // 使用线程处理客户端请求。
                new Thread(new ServerThread(socket)).start();
            }

        }catch (IOException e) {
            System.out.println("服务端IO异常：" + e.getMessage());
        }

    }
}
